package com.cn.service;

import com.cn.dao.NewsDao;
import com.cn.entity.NewsEntity;
import com.cn.serviceIntface.NewsServiceIntface;
import com.cn.utilOne.Expression;
import com.cn.utilOne.PageBean;

import java.sql.SQLException;
import java.util.List;

public class NewsService implements NewsServiceIntface {
    NewsDao ndao = new NewsDao();

    @Override
    public List<NewsEntity> queryAll() throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException {
        return ndao.queryAll();
    }

    @Override
    public PageBean<NewsEntity> findByCriteria(List<Expression> expressionList, int pc) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException {
        return ndao.findByCriteria(expressionList, pc);
    }


    @Override
    public NewsEntity queryById(NewsEntity newsEntity) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException {
        return ndao.queryById(newsEntity);
    }

    @Override
    public int addNews(NewsEntity newsEntity) throws SQLException, ClassNotFoundException {
        return ndao.addNews(newsEntity);
    }

    @Override
    public int updateNewsById(NewsEntity newsEntity) {
        return 0;
    }

    @Override
    public int cont(String sql) {
        return ndao.cont(sql);
    }

    @Override
    public List<NewsEntity> findAll(int pc, int ps) {
        return ndao.findAll(pc, ps);
    }
}
